<?php $content = '
$(document).ready(function(){
	$("#chkt_payment_modules input[type=radio]").change(updatePaymentModule);
	updateShippingModule();
	if($("#button_save_payment").parents("div").length > 0)
		$($("#button_save_payment").parents("div").get(0)).hide();
});
var shipping_interval;
var payment_interval;
function check_form_optional(a){
	var b=a;
	var c=b.elements[\'firstname\'].value;
	var d=b.elements[\'lastname\'].value;
	var e=b.elements[\'street_address\'].value;
	if(c==\'\'&&d==\'\'&&e==\'\') 
		return true;
	else 
		return check_form(a)
}
function checkout_laws(){
	var a=\'\';
	var b=\'\';
	var c=\'\';';
	
if(DISPLAY_CONDITIONS_ON_CHECKOUT=='true')
	$content .= 'if(!$(\'input[name=conditions]\').is(\':checked\')){a+=\''.CHECKOUT_ERROR_CONDITIONS.'\'}';
if(DISPLAY_REVOCATION_ON_CHECKOUT=='true')
	$content .= 'if(!$(\'input[name=revocation]\').is(\':checked\')){b+=\''.CHECKOUT_ERROR_REVOCATION.'\'}';
if(DISPLAY_DATENSCHUTZ_ON_CHECKOUT=='true')
	$content .= 'if(!$(\'input[name=dsg]\').is(\':checked\')){c+=\''.CHECKOUT_ERROR_DSG.'\'}';
$content .= 'return{agb_error:a,revocation_error:b,dsg_error:c}}function checkout(){var a=checkout_laws();if(a.agb_error!=\'\'||a.revocation_error!=\'\'||a.dsg_error!=\'\'){var b=\'\';if(a.agb_error!=\'\'){b+=a.agb_error+\'\n\n\'}if(a.dsg_error!=\'\'){b+=a.dsg_error+\'\n\n\'}if(a.revocation_error!=\'\'){b+=a.revocation_error+\'\n\n\'}if(b!=\'\')alert(b)}else{animateCheckout();xajax_checkout_check($(\'#checkout\').serialize());}}$(function(){if(pmodule_length==1){$(\'.payment_module_body\').fadeIn()};$(\'.use_gv\').live(\'click\',function(){if($(this).is(\':checked\')){xajax_useGV(1)}else{xajax_useGV(0)}});';
if(isset($_GET['gv_cover']))
	$content .= '$("#form_payment_modules input:radio:first").attr("checked", true);updatePaymentModule()';
$content .= '});
function animateCheckout(){
	$(\'.checkout_body\').animate({opacity:0.4});
	$(\'.checkout_body a\').click(function(){return false});
	$(\'<div class="checkout_animation" style="position:absolute;bottom:70px;left:50%;margin-left:-20px;font-weight:700;font-size:120%"> <img src="images/ajax_spinner.gif" style="position:relative;top:10px;left:-10px" />'.CHECKOUT_PLEASE_WAIT.'</div>\').insertAfter($(\'.checkout_body\'))
}
function removeAnimation(){$(\'.checkout_animation\').remove();$(\'.checkout_body\').animate({opacity:1});$.scrollTo($(\'#acc_payment\'),800);$(\'.checkout_body\').accordion(\'activate\',\'#acc_payment\')}
function hideFromStart(a){$(\'#chkt_\'+a).hide();$(\'#btn_\'+a).html(\'+\')}
function showFromStart(a){$(\'#chkt_\'+a).show();$(\'#btn_\'+a).html(\'-\');}
function slideInOrOut(a){$(\'#chkt_\'+a).slideToggle(\'slow\',function(){if($(\'#chkt_\'+a).is(\':visible\')){$(\'#btn_\'+a).html(\'-\')}else{$(\'#btn_\'+a).html(\'+\')}})}
function paymentShowOrHide(a){$(\'#payment_module_error\').html(\'\');showFromStart(\'payment_modules\');clearInterval(payment_interval);payment_interval = setInterval("blinkBlink(\'payment\')", 500);}
function paymentShowOrHide2(a){
	var b=document.getElementById(\'payments\').getElementsByTagName(\'div\');
	try{for(var y=0;y<b.length;y++){if(b[y].id!=(\'pmodule_\'+a)&&b[y].className==\'pmodule\'){b[y].style.display=\'none\'}else{b[y].style.display=\'\'}}}catch(e){}finally{$(\'#payment_module_error\').html(\'\');showFromStart(\'payment_modules\');if($(\'#button_save_payment\').is(\':visible\')){$(\'#button_save_payment\').addClass(\'pulsate\')}}}
function shippingShowOrHide(a){showFromStart(\'shipping_modules\');if($(\'#button_save_shipping\').is(\':visible\')){$(\'#button_save_shipping\').addClass(\'pulsate\')}}
function activateShipping(a){try{var b=document.getElementById(\'payments\').getElementsByTagName(\'div\');for(var y=0;y<smodule_length;y++){if(a!=(\'srow\'+y)){document.getElementById(\'srow\'+y).className=\'moduleRow\'}else{document.getElementById(\'srow\'+y).className=\'moduleRowSelected\'}}}catch(e){}finally{showFromStart(\'shipping_modules\')}}
function activatePayment(a){
	try{var b=pmodule_length;for(var y=0;y<b.length;y++){if(b[y].id.indexOf(\'prow\')!=-1){if(b[y].id!=a){b[y].className=\'moduleRow\'}else{b[y].className=\'moduleRowSelected\'}}}}catch(e){}finally{if(a!=\'no\'){$(\'#payment_module_error\').html(\'\')}showFromStart(\'payment_modules\')}}
	function updateProducts(a,b){if(b==\'minus\'&&$(\'#qty_\'+a).html()==1){removeProduct(a)}else if(b==\'plus\'&&$(\'#qty_\'+a).html()=='.MAX_PRODUCTS_QTY.'){}else{$(\'#loader_products\').css(\'display\',\'inline\');
xajax_updateProducts(a,b)}}function updateAttributes(a,b){$(\'#loader_products\').css(\'display\',\'inline\');xajax_updateAttributes(a,b,$(\'#\'+a).val())}
function removeProduct(a){if(confirm(\''.CHECKOUT_REMOVE_CONFIRM.'\')){$(\'#loader_products\').css(\'display\',\'inline\');makeInactive("product_\'+id\'");
xajax_removeProduct(a)}}
function openPayment(id){
	$(\'.payment_module_body\').hide();$(\'.checkout_\'+id+\'_body\').fadeToggle();
}
function useGV(a){$(\'#loader_payment_modules\').css(\'display\',\'inline\');if(a.checked)xajax_useGV(1);else xajax_useGV(0)}
function updatePaymentModule(){
	var a=false;
	var b=true;
	if(document.getElementById(\'form_payment_modules\').payment.length>1
		&&(typeof document.getElementById(\'form_payment_modules\').payment.nodeName==\'undefined\'?true:false)){
		b=false;
		for(var o=0;o<document.getElementById(\'form_payment_modules\').payment.length;o++){
			if(document.getElementById(\'form_payment_modules\').payment[o].checked){a=true;break}
		}
	}
	if((typeof document.getElementById(\'form_payment_modules\').payment.nodeName==\'undefined\'?false:true)&&document.getElementById(\'form_payment_modules\').payment.value.length>=2&&document.getElementById(\'form_payment_modules\').payment.value!=\'no\'){a=true}
	if(a){
		xajax_updatePaymentModule(xajax.getFormValues(\'form_payment_modules\'));
		$(\'#loader_payment_modules\').css(\'display\',\'inline\');
		makeInactive(\'form_payment_modules\')
	}
	else{
		alert(\''.CHECKOUT_NO_PAYMENT_MODULE_SELECTED.'\')
	}
	showFromStart(\'payment_modules\')
}
function updateShippingModule(){
	if ($("#form_shipping_modules input[name=shipping]:checked").length == 0) return;
	var id = $("#form_shipping_modules input[name=shipping]:checked").val();
	$(\'.shipping_module_body\').hide();
	$(\'.checkout_\'+id+\'_body\').fadeToggle();

	var a=false;
	var b=true;
	if($("#form_shipping_modules input[name=shipping]")){
		b=false;
		if($("#form_shipping_modules :checked").size()>0){a=true}
	}
	if((typeof document.getElementById(\'form_shipping_modules\').shipping.nodeName==\'undefined\'?false:true)&&document.getElementById(\'form_shipping_modules\').shipping.value.indexOf(\'_\')!=-1){a=true}if(a){xajax_updateShippingModule(xajax.getFormValues(\'form_shipping_modules\'));$(\'#loader_shipping_modules\').css(\'display\',\'inline\');makeInactive(\'form_shipping_modules\')}else{alert(\''.CHECKOUT_NO_SHIPPING_MODULE_SELECTED.'\')}showFromStart(\'shipping_modules\')}
function updateAddressBySelect(a,b){$(\'#loader_\'+a+\'_address\').css(\'display\',\'inline\');makeInactive(\'chkt_\'+a+\'_address\');xajax_updateAddressBySelect(a,b)}function editAddress(a){$(\'#loader_\'+a+\'_address\').css(\'display\',\'inline\');xajax_updateAddressSelect(a)}function cancelAddress(a){$(\'#\'+a+\'_address_select\').fadeToggle();$(\'#\'+a+\'_address\').show();$(\'#\'+a+\'_address_button_edit\').show();$(\'#\'+a+\'_address_button_save\').hide();showFromStart(a+\'_address\')}function updateAddress(a){$(\'#loader_\'+a+\'_address\').css(\'display\',\'inline\');
xajax_updateAddress(xajax.getFormValues(\'form_\'+a+\'_address\'),a);makeInactive(a+\'_address_select\')}function updateStates(a,b){$(\'#loader_\'+b.id.substr(5)).css(\'display\',\'inline\');xajax_updateStates(a,b.id)}
function showSelect(a){$(\'#atta_\'+a).hide();$(\'#attd_\'+a).show();$(\'#attd_\'+a+\' select\').attr(\'disable\',\'false\');showFromStart(\'products\')}
function makeInactive(a){$(\'#\'+a+\' input, #\'+a+\' select\').each(function(){$(this).attr(\'disabled\',true)})}function makeActive(a){$(\'#\'+a+\' input, #\'+a+\' select\').each(function(){$(this).attr(\'disabled\',false)})}
function updateBecauseItsVirtual(){$(\'#virtual_address\').show();$(\'#not_virtual_address\').hide();$(\'#virtual_modules\').show();$(\'#free_shipping_modules\').hide();$(\'#not_virtual_modules\').hide();$(\'#checkout_error_shipping\').hide();$(\'#checkout_error_shipping\').html(\'\');if($(\'#btn_shipping_address\').html()==\'-\')showFromStart(\'shipping_address\');if($(\'#btn_shipping_modules\').html()==\'-\')showFromStart(\'shipping_modules\')}function updateBecauseItsFreeShipping(){$(\'#free_shipping_modules\').show();$(\'#not_virtual_modules\').show();if($(\'#btn_shipping_modules\').hmtl()==\'-\')showFromStart(\'shipping_modules\')}function updateBecauseItsNotFreeShipping(){$(\'#free_shipping_modules\').hide();$(\'#not_virtual_modules\').show();if($(\'#btn_shipping_modules\').hmtl()==\'-\')showFromStart(\'shipping_modules\')}function blinkBlink(button){try{var form=document.getElementById(\'form_\'+button+\'_modules\');if(form[button].value != \'no\'){if($(\'.checkout_\'+button+\'_modules\').hasClass(\'blinki\')) {$(\'.checkout_\'+button+\'_modules\').removeClass(\'blinki\');}else{$(\'.checkout_\'+button+\'_modules\').addClass(\'blinki\');}}else{clearBlinkBlink(button);}}catch(e){}}function clearBlinkBlink(a){try{if(a==\'payment\'){clearInterval(payment_interval);$(\'.checkout_payment_modules\').removeClass(\'blinki\');}else{clearInterval(shipping_interval);$(\'.checkout_shipping_modules\').removeClass(\'blinki\');}}catch(e){}}';